import { request } from "@/utils/request";


/**
 * 获取商家订单列表
 * @param params 查询参数
 */
export const getMOrderList = (params?: PaginateQuery<IOrder & { shop_name?: string }>) => {
  return request.get<PaginateResponse<IOrder>>('dd_ddgl/business_order/orderList', { params })
}

/**
 * 同步订单(商家)
 * @param shop_id 店铺ID
 */
export const syncMOrders = (shop_id?: number) => {
  // return request.get('dd_ddgl/business/getOrder', { params: { shop_id } })
  return request.get('dd_ddgl/business_order/getOrder', { params: { shop_id } })

  // dd_ddgl/business_order/getOrder
}

/**
 * 获取供应链订单列表
 * @param params 查询参数
 */
export const getSOrderList = (params?: PaginateQuery<IOrder>) => {
  return request.get<PaginateResponse<IOrder>>('dd_ddgl/supply_chain/orderList', { params })
}

export const getSPostOrders = (params?: PaginateQuery<SupportPostOrderQuery>) => {
  return request.get<PaginateResponse<IOrder>>('dd_ddgl/supply_chain/getWaitSendOrder', { params })
}

/**
 * 商家订单备注
 */
export const commentOrder = (data: OrderCommentReq) => {
  return request.post('dd_ddgl/business_order/orderSellerWords', data)
}

/**
 * 查询相同 sku_id 的订单
 * @param params
 */
export const getMerchOrdersBySKU = (params?: { sku_id: string }) => {
  return request.get<IResponse<IOrder[]>>('dd_ddgl/business_order/sameGoodsIdOrderList', { params })
}

/**
 * 批量更新 SKU Code
 * @param data
 */
export const updateSKUCode = (data: UpdateSKUCodeReq) => {
  return request.post('dd_ddgl/business_order/updateSameGoodsIdOrder', data)
}

/**
 * 确认发货
 * @param order_id
 */
export const deliveryOrder = (order_id: (number|string)[]) => {
  return request.post<IResponse<DeliveryOrderResp>>('dd_ddgl/supply_chain/deliveryOrder', { order_id })
}

/**
 * 统计(供应链)
 */
export const SupplyChainStatistics = () => {
  return request.get<IResponse<SupplyChainStatisticsResp>>('dd_ddgl/supply_chain_total/index')
}

/**
 * 订单备注(供应链)
 * @param data
 * @constructor
 */
export const SupplyChainOrderRemark = (data: SupplyChainOrderRemarkReq) => {
  return request.post('dd_ddgl/supply_chain/orderFactoryWords', data)
}